!{include file='common/header.htm'}
<link rel="stylesheet" href="/template/js/editor/kindEditor/themes/default/default.css" />
<link rel="stylesheet" href="/template/js/jquery_plus/autocomplete/jquery-autocomplete.css" type="text/css"/>
<div class="main_content wrap" id="main_content">
	<div class="left_content" id="wiki_edit_content">
		<h1><a href="/wiki/!{$wiki.word}">!{$wiki.word}</a></h1>
		<form id="wiki_form" action="/wiki/edit" method="post">
			<input type="hidden" value="!{$item_title}" name="p"/>
			<h3 flexible-nav>基本信息</h3>
			<div class="form_item">
				<strong>当前分类：</strong>
				<div>
					!{if $wiki.cate}
					!{$cates[$wiki.cate]}
					!{else}
					!{html_options options=$cates name='cate'}
					!{/if}
				</div>
			</div>
			<div class="form_item">
				<strong>现有标签：</strong>
				<div>
					!{foreach from=$wiki.tags key=tag item=tag_count}
					<span>!{$tag} (!{$tag_count})</span>
					!{/foreach}
				</div>
			</div>
			<div class="form_item">
				<strong>添加标签：</strong>
				<input type="text" class="text_input" name="tags" value=""/>
				<p>多个标签使用逗号分隔</p>
			</div>
			<div class="form_item">
				<h3 flexible-nav class="item_maps">地图</h3>
				<div class="right_float maps_address">
					地址：<input type="text" class="text_input" name="address" value="!{$wiki.word}" id="address"/>
				</div>
				<div class="form_item item_maps maps_contner" id="maps"></div>
			</div>
			<!--  
			<h3 flexible-nav class="item_maps">相关词条</h3>
			<div class="form_item item_maps">
			</div>
			-->
			<div class="center opt_div">
				<input type="hidden" value="!{$wiki.word}" name="q"/>
				<input type="submit" value="保存" class="submit_btn botton"/>
			</div>
		</form>
	</div>
	<div class="right_content wiki_ext_info">
		<a href="/wiki/add"><img src="!{res file='template/wiki/images/add_word.jpg'}" alt="添加词条"/></a>
		!{include file='./_creator.htm'}
		!{include file='./_word_index.htm'}
	</div>
</div> 
<!--  
<script src="/template/js/editor/kindEditor/kindeditor-min.js"></script>
<script src="/template/js/editor/kindEditor/lang/zh_cn.js"></script>
<script src="!{res file='js/jquery_plus/jquery.form.js'}"></script>
-->
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<script type="text/javascript" src="/template/js/jquery_plus/jquery-gmap3-4.1/gmap3.min.js"></script>
<script type="text/javascript" src="/template/js/jquery_plus/autocomplete/jquery-autocomplete.min.js"></script>
<script>
	$(function(){
		$("#maps").gmap3({
			action:'addMarker',
			address : '!{$wiki.word}',
			map:{
				center: true,
				zoom: 14
			},
			marker : {
				options:{
					draggable: true,
					animation: google.maps.Animation.DROP
				}
			}
		});
		
		$('#address').autocomplete({
			source: function() {
				$("#maps").gmap3({
					action:'getAddress',
					address: $(this).val(),
					callback:function(results){
						if (!results) return;
						$('#address').autocomplete(
							'display',
							results,
							false
						);
					}
				});
			},
			cb:{
				cast: function(item){
					return item.formatted_address;
				},
				select: function(item) {
					$("#maps").gmap3(
						{action:'clear', name:'marker'},
						{
							action:'addMarker',
							latLng:item.geometry.location,
							map:{center:true},
							marker : {
								options:{
									draggable: true,
									animation: google.maps.Animation.DROP
								}
							}
						}
					);
				}
			}
		});
		
		$('.submit_btn').button();
	});
</script>
!{include file='common/footer.htm'}